from django.db import models
from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
    phone=models.CharField(max_length=11)
    gender=models.IntegerField(choices=((0,'男'),(1,'女')))
    address=models.CharField(max_length=20)

class Code(models.Model):
    code=models.CharField(max_length=6)
    phone=models.CharField(max_length=11)
    created=models.DateTimeField(auto_now_add=True)


class Token(models.Model):
    key=models.CharField(max_length=32)
    user=models.OneToOneField(User,on_delete=True)
    created=models.DateTimeField(auto_now_add=True)


